package top.oool.actuator;

import lombok.Data;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Created by IntelliJ IDEA.
 * User: kui.zhang
 * Date: 2019/4/24 17:23
 * Email:kui.zhang@chinaredstar.com
 */

@Endpoint(id = "system-info-endpoint")
public class SystemInfoEndpoint {
    private SystemInfoProperties systemInfoProperties;

    public SystemInfoEndpoint(SystemInfoProperties systemInfoProperties) {
        this.systemInfoProperties = systemInfoProperties;
    }
//
//    @ReadOperation
//    public Map<String, String> getSysInfo(String str) {
//        Map<String, String> map = new HashMap<>();
//        map.put("appName", systemInfoProperties.getAppName());
//        map.put("appId", systemInfoProperties.getAppId());
//        map.put("desc", systemInfoProperties.getDesc());
//        map.put("str", str);
//        return map;
//    }

    @ReadOperation
    public Map<String, String> getSysEnv() {
        return System.getenv();
    }
}
